package org.arch_learn.orm_starter.auto_config;


import org.arch_learn.flashboot.ConnectionManager;
import org.arch_learn.flashboot.autoconfigure.Bean;
import org.arch_learn.flashboot.autoconfigure.ConditionalOnBean;
import org.arch_learn.flashboot.autoconfigure.ConfigAfter;
import org.arch_learn.flashboot.autoconfigure.Configuration;
import org.arch_learn.orm_starter.sqlSession.DefaultSqlSessionFactory;
import org.arch_learn.orm_starter.utils.DefaultConnectionManager;

@Configuration
@ConfigAfter(OrmAutoConfiguration.class)
@ConditionalOnBean(DefaultSqlSessionFactory.class)
public class ConnectionManagerAutoConfiguration {

    @Bean
    public ConnectionManager connectionManager(DefaultSqlSessionFactory defaultSqlSessionFactory) {
        return new DefaultConnectionManager(defaultSqlSessionFactory);
    }
}
